import React from "react";
import { Select } from "antd";
import { omit } from "lodash";
import "./index.less";
const omitKey = ["name", "path", "options"]
const { Option } = Select;
interface ISelectOption {
  label: string;
  value: any;
}
interface IVSelectProps {
  options: Array<ISelectOption>;
  [key: string]: any;
}
const VSelect: React.FC<IVSelectProps> = (props) => {
  const { options } = props;
  return <Select {...omit(props, omitKey)} size="small" className={`visbar-gui-select ${props.className}`} defaultValue={props.default}>
    {
      options.map(op => {
        return <Option key={op.value} label={op.label} value={op.value}>
          {op.label}
        </Option>
      })
    }
  </Select>
}

export default VSelect;